package com.whfc.wxmp.api.fmam.controller;

import com.whfc.common.result.PageData;
import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.wxmp.annotation.CurrentWxUser;
import com.whfc.fuum.entity.WxUser;
import com.whfc.fmam.entity.dto.FmamMatDTO;
import com.whfc.wxmp.api.fmam.service.WxFmamMatService;
import com.whfc.wxmp.util.RequestConetxtUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 物资-材料
 *
 * @author : qzexing
 * @version : 1.0
 * @date : 2020/4/23 21:42
 */
@RestController
@RequestMapping("/mp/api/fmam/mat")
public class WxFmamMatController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxFmamMatService wxFmamMatService;

    @GetMapping("/list")
    public Result list(@CurrentWxUser WxUser wxUser,
                       @RequestParam("deptId") Integer deptId,
                       @RequestParam("pageSize") Integer pageSize,
                       @RequestParam("pageNum") Integer pageNum,
                       @RequestParam(value = "keyword", required = false) String keyword) {
        logger.info("WXMPUA|{}|{}|{}|{}|{}",
                wxUser.getId(), RequestConetxtUtil.getAppType(), RequestConetxtUtil.getPage(),
                "获取材料列表", RequestConetxtUtil.getParameters());
        PageData<FmamMatDTO> matList = wxFmamMatService.matList(deptId, pageNum, pageSize, keyword);
        return ResultUtil.success(matList);
    }


}
